<!DOCTYPE html>
<html lang="zh-CN">
<head><meta name="generator" content="Hexo 3.9.0">

    <!--[if lt IE 9]>
        <style>body {display: none; background: none !important} </style>
        <meta http-equiv="Refresh" Content="0; url=//outdatedbrowser.com/" />
    <![endif]-->

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="author" content="Ren ZM">



<meta name="description" content="无论什么语言都无非是让计算机可以按照规则执行一段步骤，逃不过if-else,do-while,while,for.准备将工具语言转到JavaScript上，记录学习的简单例子。">
<meta name="keywords" content="note,JavaScript">
<meta property="og:type" content="article">
<meta property="og:title" content="JavaScript 简单使用">
<meta property="og:url" content="https://littlepro.gitee.io/mytpages/2019/09/27/JavaScript-简单使用/index.html">
<meta property="og:site_name" content="Xbiubiubiu">
<meta property="og:description" content="无论什么语言都无非是让计算机可以按照规则执行一段步骤，逃不过if-else,do-while,while,for.准备将工具语言转到JavaScript上，记录学习的简单例子。">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2019-09-29T13:39:41.066Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="JavaScript 简单使用">
<meta name="twitter:description" content="无论什么语言都无非是让计算机可以按照规则执行一段步骤，逃不过if-else,do-while,while,for.准备将工具语言转到JavaScript上，记录学习的简单例子。">

<link rel="apple-touch-icon" href="/mytpages//apple-touch-icon.png">


    <link rel="alternate" href="/atom.xml" title="Xbiubiubiu" type="application/atom+xml">



    <link rel="shortcut icon" href="/mytpages//favicon.png">



    <link href="//cdn.bootcss.com/animate.css/3.5.1/animate.min.css" rel="stylesheet">



    <link href="//cdn.bootcss.com/fancybox/2.1.5/jquery.fancybox.min.css" rel="stylesheet">



    <script src="//cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
    <link href="//cdn.bootcss.com/pace/1.0.2/themes/blue/pace-theme-minimal.css" rel="stylesheet">


<link rel="stylesheet" href="/mytpages/css/style.css">



<link href="//cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">


<title>JavaScript 简单使用 | Xbiubiubiu</title>

<script src="//cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="//cdn.bootcss.com/clipboard.js/1.5.10/clipboard.min.js"></script>

<script>
    var yiliaConfig = {
        fancybox: true,
        animate: true,
        isHome: false,
        isPost: true,
        isArchive: false,
        isTag: false,
        isCategory: false,
        fancybox_js: "//cdn.bootcss.com/fancybox/2.1.5/jquery.fancybox.min.js",
        scrollreveal: "//cdn.bootcss.com/scrollReveal.js/3.1.4/scrollreveal.min.js",
        search: false
    }
</script>


    <script> yiliaConfig.jquery_ui = [false]; </script>



    <script> yiliaConfig.rootUrl = /mytpages/; </script>







    <script src="/mytpages/live2d-widget/autoload.js"></script>


</head></html>
<body>
  <div id="container">
    <div class="left-col">
    <div class="overlay"></div>
<div class="intrude-less">
    <header id="header" class="inner">
        <a href="/mytpages/" class="profilepic">
            <img src="/mytpages//img/avatar.png" class="animated zoomIn">
        </a>
        <hgroup>
          <h1 class="header-author"><a href="/mytpages/">Ren ZM</a></h1>
        </hgroup>

        
        <p class="header-subtitle">--ロリは正義</p>
        

        


        
            <div id="switch-btn" class="switch-btn">
                <div class="icon">
                    <div class="icon-ctn">
                        <div class="icon-wrap icon-house" data-idx="0">
                            <div class="birdhouse"></div>
                            <div class="birdhouse_holes"></div>
                        </div>
                        <div class="icon-wrap icon-ribbon hide" data-idx="1">
                            <div class="ribbon"></div>
                        </div>
                        
                        <div class="icon-wrap icon-link hide" data-idx="2">
                            <div class="loopback_l"></div>
                            <div class="loopback_r"></div>
                        </div>
                        
                        
                        <div class="icon-wrap icon-me hide" data-idx="3">
                            <div class="user"></div>
                            <div class="shoulder"></div>
                        </div>
                        
                    </div>
                    
                </div>
                <div class="tips-box hide">
                    <div class="tips-arrow"></div>
                    <ul class="tips-inner">
                        <li>菜单</li>
                        <li>标签</li>
                        
                        <li>友情链接</li>
                        
                        
                        <li>关于我</li>
                        
                    </ul>
                </div>
            </div>
        

        <div id="switch-area" class="switch-area">
            <div class="switch-wrap">
                <section class="switch-part switch-part1">
                    <nav class="header-menu">
                        <ul>
                        
                            <li><a href="/mytpages//mytpages/../">主页</a></li>
                        
                            <li><a href="/mytpages//mytpages/../archives/">所有文章</a></li>
                        
                            <li><a href="/mytpages//mytpages/../tags/">标签云</a></li>
                        
                            <li><a href="/mytpages//mytpages/../about/">关于我</a></li>
                        
                        </ul>
                    </nav>
                    <nav class="header-nav">
                        <ul class="social">
                            
                                <a class="fa Email" href="mailto:784709355@qq.com" title="Email"></a>
                            
                                <a class="fa GitHub" href="https://github.com/rzzz" title="GitHub"></a>
                            
                                <a class="fa Gitee" href="https://gitee.com/littlepro" title="Gitee"></a>
                            
                                <a class="fa V2EX" href="/mytpages/" title="V2EX"></a>
                            
                                <a class="fa 知乎" href="/mytpages/" title="知乎"></a>
                            
                                <a class="fa 网易云音乐" href="/mytpages/" title="网易云音乐"></a>
                            
                                <a class="fa bilibili" href="/mytpages/" title="bilibili"></a>
                            
                        </ul>
                    </nav>
                </section>
                
                
                <section class="switch-part switch-part2">
                    <div class="widget tagcloud" id="js-tagcloud">
                        <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/mytpages/tags/JavaScript/">JavaScript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/mytpages/tags/MySql/">MySql</a></li><li class="tag-list-item"><a class="tag-list-link" href="/mytpages/tags/NodeJS/">NodeJS</a></li><li class="tag-list-item"><a class="tag-list-link" href="/mytpages/tags/Nodejs/">Nodejs</a></li><li class="tag-list-item"><a class="tag-list-link" href="/mytpages/tags/PS3/">PS3</a></li><li class="tag-list-item"><a class="tag-list-link" href="/mytpages/tags/c/">c</a></li><li class="tag-list-item"><a class="tag-list-link" href="/mytpages/tags/c/">c++</a></li><li class="tag-list-item"><a class="tag-list-link" href="/mytpages/tags/cocos2dx/">cocos2dx</a></li><li class="tag-list-item"><a class="tag-list-link" href="/mytpages/tags/markdown/">markdown</a></li><li class="tag-list-item"><a class="tag-list-link" href="/mytpages/tags/note/">note</a></li><li class="tag-list-item"><a class="tag-list-link" href="/mytpages/tags/sort/">sort</a></li><li class="tag-list-item"><a class="tag-list-link" href="/mytpages/tags/test/">test</a></li><li class="tag-list-item"><a class="tag-list-link" href="/mytpages/tags/tool/">tool</a></li><li class="tag-list-item"><a class="tag-list-link" href="/mytpages/tags/usage/">usage</a></li></ul>
                    </div>
                </section>
                
                
                
                <section class="switch-part switch-part3">
                    <div id="js-friends">
                    
                      <a class="main-nav-link switch-friends-link" href="https://hexo.io">Hexo</a>
                    
                      <a class="main-nav-link switch-friends-link" href="https://pages.github.com/">GitHub</a>
                    
                      <a class="main-nav-link switch-friends-link" href="http://moxfive.xyz/">MOxFIVE</a>
                    
                    </div>
                </section>
                

                
                
                <section class="switch-part switch-part4">
                
                    <div id="js-aboutme">ロリは正義</div>
                </section>
                
            </div>
        </div>
    </header>                
</div>
    </div>
    <div class="mid-col">
      <nav id="mobile-nav">
      <div class="overlay">
          <div class="slider-trigger"></div>
          <h1 class="header-author js-mobile-header hide"><a href="/" title="回到主页">Ren ZM</a></h1>
      </div>
    <div class="intrude-less">
        <header id="header" class="inner">
            <a href="/mytpages/" class="profilepic">
                <img src="/mytpages//img/avatar.png" class="animated zoomIn">
            </a>
            <hgroup>
              <h1 class="header-author"><a href="/mytpages/" title="回到主页">Ren ZM</a></h1>
            </hgroup>
            
            <p class="header-subtitle">--ロリは正義</p>
            
            <nav class="header-menu">
                <ul>
                
                    <li><a href="/mytpages/../">主页</a></li>
                
                    <li><a href="/mytpages/../archives/">所有文章</a></li>
                
                    <li><a href="/mytpages/../tags/">标签云</a></li>
                
                    <li><a href="/mytpages/../about/">关于我</a></li>
                
                <div class="clearfix"></div>
                </ul>
            </nav>
            <nav class="header-nav">
                        <ul class="social">
                            
                                <a class="fa Email" target="_blank" href="mailto:784709355@qq.com" title="Email"></a>
                            
                                <a class="fa GitHub" target="_blank" href="https://github.com/rzzz" title="GitHub"></a>
                            
                                <a class="fa Gitee" target="_blank" href="https://gitee.com/littlepro" title="Gitee"></a>
                            
                                <a class="fa V2EX" target="_blank" href="/mytpages/" title="V2EX"></a>
                            
                                <a class="fa 知乎" target="_blank" href="/mytpages/" title="知乎"></a>
                            
                                <a class="fa 网易云音乐" target="_blank" href="/mytpages/" title="网易云音乐"></a>
                            
                                <a class="fa bilibili" target="_blank" href="/mytpages/" title="bilibili"></a>
                            
                        </ul>
            </nav>
        </header>                
    </div>
    <link class="menu-list" tags="标签" friends="友情链接" about="关于我"/>
</nav>
      <div class="body-wrap"><article id="post-JavaScript-简单使用" class="article article-type-post" itemscope itemprop="blogPost">
  
    <div class="article-meta">
      <a href="/mytpages/2019/09/27/JavaScript-简单使用/" class="article-date">
      <time datetime="2019-09-27T03:23:48.000Z" itemprop="datePublished">2019-09-27</time>
</a>


    </div>
  
  <div class="article-inner">
    
      <input type="hidden" class="isFancy" />
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      JavaScript 简单使用
    </h1>
  

      </header>
      
      <div class="article-info article-info-post">
        
    <div class="article-category tagcloud">
    <a class="article-category-link" href="/mytpages/categories/how/">how</a>
    </div>


        
    <div class="article-tag tagcloud">
        <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/mytpages/tags/JavaScript/">JavaScript</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/mytpages/tags/note/">note</a></li></ul>
    </div>

        <div class="clearfix"></div>
      </div>
      
    
    <div class="article-entry" itemprop="articleBody">
      
          
        <p>无论什么语言都无非是让计算机可以按照规则执行一段步骤，逃不过if-else,do-while,while,for.<br>准备将工具语言转到JavaScript上，记录学习的简单例子。  </p>
<a id="more"></a>

<h3 id="基础语法"><a href="#基础语法" class="headerlink" title="基础语法"></a>基础语法</h3><blockquote>
<p><a href="https://gitee.com/littlepro/jsnotes/blob/master/index0.js" target="_blank" rel="noopener">https://gitee.com/littlepro/jsnotes/blob/master/index0.js</a></p>
</blockquote>
<ul>
<li>JavaScript内部采用utf-16编码的Unicode字符集</li>
<li>大端序，小端序，多数计算机系统采用小端序，UDP/TCP/IP协议规定把接收到的第一个字节当作高位字节看待</li>
<li>null, undefined, 变量var, 数组[], 对象{}, 函数, 方法</li>
<li>如果一个值是空字符串、数字0、undefined、null、NaN, 它视为false；(undefined == null) is true</li>
<li>原始类型：数字，字符串，布尔值，null，undefined<ul>
<li>值包装对象：Number()、String()、Boolean()</li>
</ul>
</li>
<li>对象类型：除了原始类型，都是对象类型；对象、数组、函数<ul>
<li>内置对象类型：JSON、Date、RegExp、Error、Math…</li>
</ul>
</li>
<li>闭包：作用域</li>
<li>函数：函数也是一个对象，拥有call(), apply(), bind(), toString()方法</li>
<li>方法：属于对象的函数，一般称为对象的方法</li>
<li>对象：模拟枚举，纯数据类，单例类，可构造类<ul>
<li>构造函数，对象拥有constructor指向构造函数，构造函数拥有prototype指向原型对象</li>
<li>语法糖class</li>
<li>封装，继承，伪多态</li>
</ul>
</li>
</ul>
<p>忽略作用域链，原型链，继承；定义类使用class语法糖。</p>
<h3 id="常用函数和常用对象"><a href="#常用函数和常用对象" class="headerlink" title="常用函数和常用对象"></a>常用函数和常用对象</h3><blockquote>
<p><a href="https://gitee.com/littlepro/jsnotes/blob/master/jut.js" target="_blank" rel="noopener">https://gitee.com/littlepro/jsnotes/blob/master/jut.js</a>  </p>
</blockquote>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> date = <span class="keyword">new</span> <span class="built_in">Date</span>();</span><br><span class="line"><span class="keyword">const</span> x = <span class="built_in">Math</span>.PI;</span><br><span class="line"><span class="keyword">const</span> r = <span class="built_in">Math</span>.random(); <span class="comment">// 函数返回一个浮点,伪随机数在范围[0，1)</span></span><br><span class="line"><span class="keyword">const</span> jsonObj = <span class="built_in">JSON</span>.parse(<span class="string">'&#123;"result":true, "count":42, "desc":"allok"&#125;'</span>);</span><br><span class="line"><span class="keyword">const</span> jsonStr = <span class="built_in">JSON</span>.stringify(jsonObj);</span><br><span class="line"></span><br><span class="line"><span class="keyword">const</span> myMap = <span class="keyword">new</span> <span class="built_in">Map</span>();</span><br><span class="line"><span class="keyword">const</span> keyString = <span class="string">'a string'</span>;</span><br><span class="line">myMap.set(keyString, <span class="string">"value associated with 'a string'"</span>);</span><br><span class="line">myMap.get(keyString); <span class="comment">// "value associated with 'a string'"</span></span><br><span class="line">myMap.has(keyString);</span><br><span class="line">myMap.delete(keyString);</span><br><span class="line"></span><br><span class="line"><span class="keyword">const</span> mySet = <span class="keyword">new</span> <span class="built_in">Set</span>();</span><br><span class="line">mySet.add(<span class="number">1</span>);</span><br><span class="line">mySet.has(<span class="number">1</span>);</span><br><span class="line">mySet.delete(<span class="number">1</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">// String</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">stringMethod</span>(<span class="params">str</span>) </span>&#123;</span><br><span class="line">    <span class="keyword">const</span> frist = str.chatAt(<span class="number">0</span>) || str[<span class="number">0</span>];</span><br><span class="line">    <span class="keyword">const</span> firstCode = str.charCodeAt(<span class="number">0</span>);<span class="comment">// Unicode 编码。这个返回值是 0 - 65535 之间的整数</span></span><br><span class="line">    <span class="keyword">const</span> newStr = str.concat(<span class="string">"sss"</span>);<span class="comment">// str not modify</span></span><br><span class="line">    <span class="keyword">const</span> newStr2 = str.toLowerCase() || str.toUpperCase();<span class="comment">// str not modify</span></span><br><span class="line">    <span class="keyword">const</span> idx = str.indexOf(<span class="string">"substr"</span>);</span><br><span class="line">    <span class="keyword">const</span> subStr = str.slice(<span class="number">0</span>, <span class="number">2</span>) || str.substring(<span class="number">0</span>, <span class="number">2</span>);</span><br><span class="line">    <span class="keyword">const</span> strArray = str.match(<span class="regexp">/[a-z]/g</span>);</span><br><span class="line">    <span class="keyword">const</span> strArray2 = str.split(<span class="string">""</span>);</span><br><span class="line">    str.replace(<span class="string">"需要替换的字符串"</span>, <span class="string">"新字符串"</span>);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">// Array</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">arrayMethod</span>(<span class="params">array</span>) </span>&#123;</span><br><span class="line">    <span class="keyword">var</span> myCars = <span class="keyword">new</span> <span class="built_in">Array</span>(<span class="string">"Saab"</span>, <span class="string">"Volvo"</span>, <span class="string">"BMW"</span>);<span class="comment">// length: 3</span></span><br><span class="line">    <span class="keyword">var</span> myCars2 = [<span class="string">"Saab"</span>, <span class="string">"Volvo"</span>, <span class="string">"BMW"</span>];</span><br><span class="line">    myCars[<span class="number">10</span>] = <span class="literal">undefined</span>;<span class="comment">// length: 11</span></span><br><span class="line">    <span class="keyword">var</span> newArr = myCars.concat(myCars2, myCars2);<span class="comment">// not modify myCars</span></span><br><span class="line">    <span class="keyword">var</span> str = myCars.join(<span class="string">","</span>);</span><br><span class="line">    myCars.reverse();<span class="comment">// will modify myCars</span></span><br><span class="line">    myCars.sort();<span class="comment">// will modify myCars</span></span><br><span class="line">    <span class="comment">// pop(), push(v) // 从后面删加</span></span><br><span class="line">    <span class="comment">// shift(), unshift(v) // 从前面删加</span></span><br><span class="line">    <span class="keyword">var</span> subArr = myCars.slice(<span class="number">1</span>, <span class="number">2</span>);<span class="comment">// length: 2-1</span></span><br><span class="line">    myCars.splice(<span class="number">1</span>, <span class="number">1</span>, <span class="string">"ins"</span>, <span class="string">"inss"</span>);<span class="comment">// 从1位置开始删除1个，并在删除位置插入2个</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="语法糖与内置对象"><a href="#语法糖与内置对象" class="headerlink" title="语法糖与内置对象"></a>语法糖与内置对象</h3><blockquote>
<p><a href="https://gitee.com/littlepro/jsnotes/blob/master/index1.js" target="_blank" rel="noopener">https://gitee.com/littlepro/jsnotes/blob/master/index1.js</a></p>
</blockquote>
<p>class语法糖</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">Polygon</span> </span>&#123;</span><br><span class="line">    <span class="keyword">constructor</span>(width, height) &#123;</span><br><span class="line">        <span class="keyword">this</span>.name = <span class="string">"Polygon"</span>;</span><br><span class="line">        <span class="keyword">this</span>.width = width;</span><br><span class="line">        <span class="keyword">this</span>.height = height;</span><br><span class="line">    &#125;</span><br><span class="line">    testfun1()&#123;</span><br><span class="line">        <span class="built_in">console</span>.log(<span class="string">"Polygon"</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">Square</span> <span class="keyword">extends</span> <span class="title">Polygon</span> </span>&#123;</span><br><span class="line">    <span class="keyword">constructor</span>(length) &#123;</span><br><span class="line">        <span class="comment">// 在这里, 它调用了父类的构造函数, 并将 lengths 提供给 Polygon 的"width"和"height"</span></span><br><span class="line">        <span class="keyword">super</span>(length, length);</span><br><span class="line">        <span class="comment">// 注意: 在派生类中, 必须先调用 super() 才能使用 "this"。忽略这个，将会导致一个引用错误。</span></span><br><span class="line">        <span class="keyword">this</span>.name = <span class="string">'Square'</span>;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">get</span> area() &#123;</span><br><span class="line">        <span class="keyword">return</span> <span class="keyword">this</span>.height * <span class="keyword">this</span>.width;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">set</span> area(value) &#123;</span><br><span class="line">        <span class="comment">// 注意：不可使用 this.area = value; 否则会导致循环call setter方法导致爆栈</span></span><br><span class="line">        <span class="keyword">this</span>._area = value;</span><br><span class="line">    &#125;</span><br><span class="line">    testfun1()&#123;</span><br><span class="line">        <span class="built_in">console</span>.log(<span class="string">"Square"</span>);</span><br><span class="line">    &#125;</span><br><span class="line">    testfun2()&#123;</span><br><span class="line">        <span class="built_in">console</span>.log(<span class="string">"testfun2"</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">let</span> s = <span class="keyword">new</span> Square(<span class="number">10</span>);</span><br><span class="line">s.area = <span class="number">99</span>;</span><br><span class="line"><span class="built_in">console</span>.log(s);<span class="comment">// Square &#123; name: 'Square', width: 10, height: 10, _area: 99 &#125;</span></span><br><span class="line">s.testfun1();<span class="comment">// Square</span></span><br><span class="line">s.testfun2();<span class="comment">// testfun2</span></span><br><span class="line"><span class="built_in">console</span>.log(s._area);<span class="comment">// 99</span></span><br><span class="line"><span class="built_in">console</span>.log(s.area);<span class="comment">// 100</span></span><br></pre></td></tr></table></figure>

<p>ArrayBuffer</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> buffer = <span class="keyword">new</span> <span class="built_in">ArrayBuffer</span>(<span class="number">16</span>);<span class="comment">// 16byte = 16 * 8bit</span></span><br><span class="line"> <span class="keyword">var</span> view1 = <span class="keyword">new</span> <span class="built_in">DataView</span>(buffer);<span class="comment">// 16 * 1byte</span></span><br><span class="line"> <span class="keyword">var</span> view2 = <span class="keyword">new</span> <span class="built_in">DataView</span>(buffer, <span class="number">12</span>, <span class="number">4</span>); <span class="comment">//from byte 12 for the next 4 bytes</span></span><br><span class="line"> view1.setInt8(<span class="number">12</span>, <span class="number">42</span>); <span class="comment">// put 42 in slot 12</span></span><br><span class="line"> <span class="built_in">console</span>.log(view1.getInt8(<span class="number">12</span>));<span class="comment">// 42</span></span><br><span class="line"> <span class="built_in">console</span>.log(view2.getInt8(<span class="number">0</span>));<span class="comment">// 42</span></span><br><span class="line"> <span class="comment">// 是否是小端序的判定</span></span><br><span class="line"> <span class="keyword">var</span> littleEndian = (<span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">     <span class="keyword">var</span> buffer = <span class="keyword">new</span> <span class="built_in">ArrayBuffer</span>(<span class="number">2</span>);</span><br><span class="line">     <span class="keyword">new</span> <span class="built_in">DataView</span>(buffer).setInt16(<span class="number">0</span>, <span class="number">256</span>, <span class="literal">true</span>);<span class="comment">// 设置值时，使用小端字节序</span></span><br><span class="line">     <span class="keyword">return</span> <span class="keyword">new</span> <span class="built_in">Int16Array</span>(buffer)[<span class="number">0</span>] === <span class="number">256</span>;<span class="comment">// Int16Array 使用系统字节序（由此可以判断系统字节序是否为小端字节序）</span></span><br><span class="line"> &#125;)();</span><br><span class="line"> <span class="built_in">console</span>.log(littleEndian);</span><br></pre></td></tr></table></figure>

<p>generator</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">function</span>* <span class="title">idMaker</span>(<span class="params">b</span>) </span>&#123;</span><br><span class="line">    <span class="keyword">let</span> index = b;</span><br><span class="line">    <span class="keyword">while</span> (<span class="literal">true</span>)</span><br><span class="line">        <span class="keyword">yield</span> index++;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">let</span> gen = idMaker(<span class="number">10</span>); <span class="comment">// "Generator &#123; &#125;"</span></span><br><span class="line"><span class="built_in">console</span>.log(gen);</span><br><span class="line"><span class="built_in">console</span>.log(gen.next().value); <span class="comment">// 10</span></span><br><span class="line"><span class="built_in">console</span>.log(gen.next().value); <span class="comment">// 11</span></span><br><span class="line"><span class="built_in">console</span>.log(gen.next().value); <span class="comment">// 12</span></span><br></pre></td></tr></table></figure>

<p>JavaScript-Promise</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 在JavaScript的世界中，所有代码都是单线程执行的。</span></span><br><span class="line"><span class="comment">// 由于这个“缺陷”，导致JavaScript的所有网络操作，浏览器事件，都必须是单线程异步执行。</span></span><br><span class="line"><span class="comment">// 一般用回调函数的形式，来异步执行耗时操作后，进行回调</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">callback</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">'Done;'</span>);</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">// 下面代码将依次输出：before setTimeout();after setTimeout();Done;[1秒后这个Done;才输出]</span></span><br><span class="line"><span class="built_in">console</span>.log(<span class="string">'before setTimeout();'</span>);</span><br><span class="line">setTimeout(callback, <span class="number">1000</span>);</span><br><span class="line"><span class="built_in">console</span>.log(<span class="string">'after setTimeout();'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">// 例：生成一个[0-2)之间的随机数，等待一段时间后，如果小于1，则返回成功，否则返回失败</span></span><br><span class="line"><span class="keyword">let</span> counter = <span class="number">1</span>;</span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">test</span>(<span class="params">resolve0, reject0</span>) </span>&#123;</span><br><span class="line">    <span class="keyword">var</span> value = <span class="built_in">Math</span>.random() * <span class="number">2</span>;</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">'set value: '</span> + value);</span><br><span class="line">    setTimeout(<span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">        <span class="keyword">if</span> (value &lt; <span class="number">1</span>) &#123;</span><br><span class="line">            <span class="built_in">console</span>.log(<span class="string">'call resolve()...'</span>);</span><br><span class="line">            resolve0(<span class="string">'200 OK'</span> + value);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">else</span> &#123;</span><br><span class="line">            <span class="built_in">console</span>.log(<span class="string">'call reject()...'</span>);</span><br><span class="line">            reject0(<span class="string">'404 NOT'</span> + value);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;, counter * <span class="number">2000</span>);</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">// 这个函数执行需要花费一些时间，所以用异步来执行它，不得不传递两个回调</span></span><br><span class="line"><span class="comment">// 那么我们可以这么来调用它</span></span><br><span class="line">test(<span class="function"><span class="keyword">function</span> (<span class="params">succ</span>) </span>&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(succ);</span><br><span class="line">&#125;, <span class="function"><span class="keyword">function</span> (<span class="params">fail</span>) </span>&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(fail);</span><br><span class="line">&#125;);</span><br><span class="line"></span><br><span class="line"><span class="comment">// 现在有Promise对象，承诺将来会执行回调，构造一个Promise对象需要提供一个函数，该函数有两个参数，一般分别是resolve和reject</span></span><br><span class="line"><span class="comment">// 参数名不重要，重要的是第一个回调会使promise的状态改为fulfilled（完成），第二个为rejected（失败）</span></span><br><span class="line">counter++;</span><br><span class="line"><span class="keyword">var</span> p1 = <span class="keyword">new</span> <span class="built_in">Promise</span>(test);<span class="comment">// 这里test函数立马就开始执行了，且执行完了，只是内部的其他异步函数被异步执行了</span></span><br><span class="line"><span class="keyword">var</span> p2 = p1.then(<span class="function"><span class="keyword">function</span> (<span class="params">result</span>) </span>&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">'成功0：'</span> + result);</span><br><span class="line">&#125;);</span><br><span class="line"><span class="keyword">var</span> p3 = p2.catch(<span class="function"><span class="keyword">function</span> (<span class="params">reason</span>) </span>&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">'失败0：'</span> + reason);</span><br><span class="line">&#125;);</span><br><span class="line"><span class="comment">// 或者串联起来</span></span><br><span class="line">counter++;</span><br><span class="line"><span class="keyword">var</span> p = <span class="keyword">new</span> <span class="built_in">Promise</span>(test).then(<span class="function"><span class="keyword">function</span> (<span class="params">result</span>) </span>&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">'成功1：'</span> + result);</span><br><span class="line">&#125;).catch(<span class="function"><span class="keyword">function</span> (<span class="params">reason</span>) </span>&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">'失败1：'</span> + reason);</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>

<p>JavaScript-await</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// await 操作符用于等待一个Promise对象的resolve回调，如果返回了reject，那么需要写在try的catch里(因为await会将这个错误抛出)；</span></span><br><span class="line"><span class="comment">//       它只能在异步函数'async function'中使用。</span></span><br><span class="line"><span class="comment">// async 函数返回的是一个promise对象，如果要获取到promise返回值，应该用then方法；</span></span><br><span class="line"><span class="comment">//       如果async函数中有返回一个值，当调用该函数时，内部会调用Promise.solve()方法把它转化成一个promise对象作为返回，</span></span><br><span class="line"><span class="comment">//       但如果async函数内部抛出错误，那么就会调用Promise.reject()返回一个promise对象。</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">doubleAfter2seconds</span>(<span class="params">num</span>) </span>&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">"enter1"</span>);</span><br><span class="line">    <span class="keyword">return</span> <span class="keyword">new</span> <span class="built_in">Promise</span>(<span class="function">(<span class="params">resolve, reject</span>) =&gt;</span> &#123;</span><br><span class="line">        <span class="built_in">console</span>.log(<span class="string">"enter2"</span>);</span><br><span class="line">        setTimeout(<span class="function"><span class="params">()</span> =&gt;</span> &#123;</span><br><span class="line">            <span class="built_in">console</span>.log(<span class="string">"enter4"</span>);</span><br><span class="line">            resolve(<span class="number">2</span> * num);</span><br><span class="line">        &#125;, <span class="number">2000</span>);</span><br><span class="line">        <span class="built_in">console</span>.log(<span class="string">"enter3"</span>);</span><br><span class="line">    &#125;);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">async</span> <span class="function"><span class="keyword">function</span> <span class="title">testResult</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">"enter0"</span>);</span><br><span class="line">    <span class="keyword">let</span> result = <span class="keyword">await</span> doubleAfter2seconds(<span class="number">30</span>);</span><br><span class="line">    <span class="built_in">console</span>.log(result);</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">"enter5"</span>);</span><br><span class="line">    <span class="keyword">return</span> <span class="string">"ok"</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="built_in">console</span>.log(<span class="string">"begin"</span>);</span><br><span class="line"><span class="keyword">let</span> promiseH = testResult();</span><br><span class="line"><span class="built_in">console</span>.log(promiseH);<span class="comment">// Promise &#123; &lt;pending&gt; &#125;</span></span><br><span class="line"><span class="built_in">console</span>.log(<span class="string">"end"</span>);</span><br><span class="line">promiseH.then(<span class="function">(<span class="params">succ</span>) =&gt;</span> &#123;</span><br><span class="line">    <span class="built_in">console</span>.log(succ);</span><br><span class="line">&#125;);</span><br><span class="line"></span><br><span class="line"><span class="comment">// 依次打印</span></span><br><span class="line"><span class="comment">//begin</span></span><br><span class="line"><span class="comment">//enter0</span></span><br><span class="line"><span class="comment">//enter1</span></span><br><span class="line"><span class="comment">//enter2</span></span><br><span class="line"><span class="comment">//enter3</span></span><br><span class="line"><span class="comment">//Promise &#123; &lt;pending&gt; &#125;</span></span><br><span class="line"><span class="comment">//end</span></span><br><span class="line"><span class="comment">//enter4</span></span><br><span class="line"><span class="comment">//60</span></span><br><span class="line"><span class="comment">//enter5</span></span><br><span class="line"><span class="comment">//ok</span></span><br></pre></td></tr></table></figure>

<h3 id="模块"><a href="#模块" class="headerlink" title="模块"></a>模块</h3><p>JavaScript-es6模块，单独记录一篇笔记。</p>

      
    </div>
    
  </div>
  
    


    <nav id="article-nav">
        
            <div id="article-nav-newer" class="article-nav-title">
                <a href="/mytpages/2019/09/27/JavaScript-模块/">
                    JavaScript-模块
                </a>
            </div>
        
        
            <div id="article-nav-older" class="article-nav-title">
                <a href="/mytpages/2019/09/27/github-gitee-chrome文件树插件/">
                    github &amp; gitee chrome文件树插件
                </a>
            </div>
        
    </nav>

  
</article>

    <div id="toc" class="toc-article">
        <strong class="toc-title">文章目录</strong>
        
            <ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#基础语法"><span class="toc-number">1.</span> <span class="toc-text">基础语法</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#常用函数和常用对象"><span class="toc-number">2.</span> <span class="toc-text">常用函数和常用对象</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#语法糖与内置对象"><span class="toc-number">3.</span> <span class="toc-text">语法糖与内置对象</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#模块"><span class="toc-number">4.</span> <span class="toc-text">模块</span></a></li></ol>
        
    </div>
    <style>
        .left-col .switch-btn,
        .left-col .switch-area {
            display: none;
        }
        .toc-level-3 i,
        .toc-level-3 ol {
            display: none !important;
        }
    </style>

    <input type="button" id="tocButton" value="隐藏目录"  title="点击按钮隐藏或者显示文章目录">

    <script>
        yiliaConfig.toc = ["隐藏目录", "显示目录", !!"false"];
    </script>



    
<div class="share">
    
        <div class="bdsharebuttonbox">
            <a href="#" class="fa fa-twitter bds_twi" data-cmd="twi" title="分享到推特"></a>
            <a href="#" class="fa fa-weibo bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
            <a href="#" class="fa fa-qq bds_sqq" data-cmd="sqq" title="分享给 QQ 好友"></a>
            <a href="#" class="fa fa-files-o bds_copy" data-cmd="copy" title="复制网址"></a>
            <a href="#" class="fa fa fa-envelope-o bds_mail" data-cmd="mail" title="通过邮件分享"></a>
            <a href="#" class="fa fa-weixin bds_weixin" data-cmd="weixin" title="生成文章二维码"></a>
            <a href="#" class="fa fa-share-alt bds_more" data-cmd="more"></i></a>
        </div>
        <script>
            window._bd_share_config={
                "common":{"bdSnsKey":{},"bdText":"JavaScript 简单使用　| Xbiubiubiu　","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"24"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
        </script>
    

    
</div>







    




    <div class="scroll" id="post-nav-button">
        
            <a href="/mytpages/2019/09/27/JavaScript-模块/" title="上一篇: JavaScript-模块">
                <i class="fa fa-angle-left"></i>
            </a>
        

        <a title="文章列表"><i class="fa fa-bars"></i><i class="fa fa-times"></i></a>

        
            <a href="/mytpages/2019/09/27/github-gitee-chrome文件树插件/" title="下一篇: github &amp; gitee chrome文件树插件">
                <i class="fa fa-angle-right"></i>
            </a>
        
    </div>

    <ul class="post-list"><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/12/13/cpp：allocator-new/">cpp：allocator,new</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/28/CPP标准库-note/">CPP标准库-note</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/27/C与win32API/">C与win32API</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/27/C标准库-note/">C标准库</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/26/cpp的lib和dll/">cpp的lib和dll</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/25/编译cpp-vs2015/">编译cpp-vs2015</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/23/编译cpp-准备/">编译c++准备</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/18/simple-opengl/">simple opengl</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/15/cocos2dx-action/">cocos2dx-action</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/15/cocos2dx-schedule/">cocos2dx-schedule</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/14/cocos2dx在win32上写日志文件/">cocos2dx在win32上写日志文件</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/14/cocos2dx在win32上播放ogg/">cocos2dx在win32上播放ogg</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/14/cocos2dx字库缺失文字处理/">cocos2dx字库缺失文字处理</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/14/cocos2dx工作目录修改/">cocos2dx工作目录修改</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/13/cocos2dx-android/">cocos2dx-android</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/12/cocos2dx-win32/">cocos2dx-win32</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/11/Sublimer-Text/">Sublimer Text</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/07/潜意识？？设计模式/">潜意识？？设计模式</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/04/BST？AVL？红黑树？/">BST？AVL？红黑树？</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/11/01/几种排序算法示例代码/">几种排序算法示例代码</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/10/31/引子-基础算法？？/">引子-基础算法？？</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/10/31/引子-数据结构？？/">引子-数据结构？？</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/10/25/不会懂分布式系统的/">不会懂分布式系统的</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/10/24/MySql简单使用-adv/">MySql简单使用-adv</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/10/24/MySql简单使用/">MySql简单使用</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/10/18/PS3-HEN破相关记录/">PS3-HEN破相关记录</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/10/09/测试使用云函数扩展码云page/">测试使用云函数扩展码云page</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/10/09/web3-单页Web应用/">web3.单页Web应用</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/09/29/web2-简单网站的前后端分离/">web2.简单网站的前后端分离</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/09/29/web1-创建一个简单的网站/">web1.创建一个简单的网站</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/09/27/NodeJS-简单使用/">NodeJS 简单使用</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/09/27/JavaScript-other/">JavaScript-other</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/09/27/JavaScript-模块/">JavaScript-模块</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/09/27/JavaScript-简单使用/">JavaScript 简单使用</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/09/27/github-gitee-chrome文件树插件/">github & gitee chrome文件树插件</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/09/26/markdown-简单使用/">markdown 简单使用示例</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/09/25/hello-world/">Hello World</a></li><li class="post-list-item"><a class="post-list-link" href="/mytpages/2019/09/24/zzTest-article0/">zzTest article0</a></li></ul>




    <script>
        
    </script>
</div>
      <footer id="footer">
    <div class="outer">
        <div id="footer-info">
            <div class="footer-left">
                <i class="fa fa-copyright"></i> 
                2019-2020 Ren ZM
            </div>
            <div class="footer-right">
                <a href="http://hexo.io/" target="_blank" title="快速、简洁且高效的博客框架">Hexo</a>  Theme <a href="https://github.com/MOxFIVE/hexo-theme-yelee" target="_blank" title="简而不减 Hexo 双栏博客主题  v3.5">Yelee</a> by MOxFIVE <i class="fa fa-heart animated infinite pulse"></i>
            </div>
        </div>
        
            <div class="visit">
                
                    <span id="busuanzi_container_site_pv" style='display:none'>
                        <span id="site-visit" title="本站到访数"><i class="fa fa-user" aria-hidden="true"></i><span id="busuanzi_value_site_uv"></span>
                        </span>
                    </span>
                
                
                    <span>| </span>
                
                
                    <span id="busuanzi_container_page_pv" style='display:none'>
                        <span id="page-visit"  title="本页阅读量"><i class="fa fa-eye animated infinite pulse" aria-hidden="true"></i><span id="busuanzi_value_page_pv"></span>
                        </span>
                    </span>
                
            </div>
        
    </div>
</footer>
    </div>
    
<script data-main="/mytpages/js/main.js" src="//cdn.bootcss.com/require.js/2.2.0/require.min.js"></script>

    <script>
        $(document).ready(function() {
            var iPad = window.navigator.userAgent.indexOf('iPad');
            if (iPad > -1 || $(".left-col").css("display") === "none") {
                var bgColorList = ["#9db3f4", "#414141", "#e5a859", "#f5dfc6", "#c084a0", "#847e72", "#cd8390", "#996731"];
                var bgColor = Math.ceil(Math.random() * (bgColorList.length - 1));
                $("body").css({"background-color": bgColorList[bgColor], "background-size": "cover"});
            }
            else {
                var backgroundnum = 5;
                var backgroundimg = "url(/mytpages//background/bg-x.jpg)".replace(/x/gi, Math.ceil(Math.random() * backgroundnum));
                $("body").css({"background": backgroundimg, "background-attachment": "fixed", "background-size": "cover"});
            }
        })
    </script>





<div class="scroll" id="scroll">
    <a href="#" title="返回顶部"><i class="fa fa-arrow-up"></i></a>
    <a href="#comments" onclick="load$hide();" title="查看评论"><i class="fa fa-comments-o"></i></a>
    <a href="#footer" title="转到底部"><i class="fa fa-arrow-down"></i></a>
</div>
<script>
    // Open in New Window
    
        var oOpenInNew = {
            
            
            
            
            
            
             archives: ".archive-article-title", 
             miniArchives: "a.post-list-link", 
            
             friends: "#js-friends a", 
             socail: ".social a" 
        }
        for (var x in oOpenInNew) {
            $(oOpenInNew[x]).attr("target", "_blank");
        }
    
</script>

<script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js">
</script>
  </div>
</body>
</html>